﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.ComponentModel;
using NovinMedia.Data;

namespace asscope.Data.Layer
{
    [DataObject(true)]
    public class Sports
    {
       
        [DataObjectMethod(DataObjectMethodType.Fill)]
        public DataSet SelectAll()
        {
            DbObject dbo = new DbObject();
            SqlParameter[] parameters = new SqlParameter[]
                {
 
                };
            return dbo.RunProcedure("sp_Sports_SelectAll", parameters, "Sports");
        }

        [DataObjectMethod(DataObjectMethodType.Fill)]
        public DataSet SelectRow(string Code)
        {
            DbObject dbo = new DbObject();
            SqlParameter[] parameters = new SqlParameter[]
                {
					new SqlParameter("Code",Code) 
                };
            return dbo.RunProcedure("sp_Sports_SelectRow", parameters, "Sports");
        }

        [DataObjectMethod(DataObjectMethodType.Insert)]
        public int InsertRow(string Code, string Name, string Title, string Description, string IsActivate)
        {
            int RowsAffected = 0;
            int Result = 0;
            DbObject dbo = new DbObject();
            SqlParameter[] parameters = new SqlParameter[]
				{
					new SqlParameter("Code",Code),
					new SqlParameter("Name",Name),
					new SqlParameter("Title",Title),
					new SqlParameter("Description",Description),
					new SqlParameter("IsActivate",IsActivate) 
				};
            Result = dbo.RunProcedure("sp_Sports_Insert", parameters, out RowsAffected);
            return Result;
        }

        [DataObjectMethod(DataObjectMethodType.Update)]
        public int UpdateRow(string Code, string Name, string Title, string Description, string IsActivate)
        {
            int RowsAffected = 0;
            int Result = 0;
            DbObject dbo = new DbObject();
            SqlParameter[] parameters = new SqlParameter[]
				{
					new SqlParameter("Code",Code),
					new SqlParameter("Name",Name),
					new SqlParameter("Title",Title),
					new SqlParameter("Description",Description),
					new SqlParameter("IsActivate",IsActivate) 
				};
            Result = dbo.RunProcedure("sp_Sports_Update", parameters, out RowsAffected);
            return Result;
        }

        [DataObjectMethod(DataObjectMethodType.Delete)]
        public int DeleteRow(string Code)
        {
            int RowsAffected = 0;
            int Result = 0;
            DbObject dbo = new DbObject();
            SqlParameter[] parameters = new SqlParameter[]
				{
					new SqlParameter("Code",Code) 
				};
            Result = dbo.RunProcedure("sp_Sports_DeleteRow", parameters, out RowsAffected);
            return Result;
        }
    }
}